
<style>
    @media (min-width: 768px){
        .roleList {
            margin-right: 0;
            margin-left: 0;
            background-color: #fff;
            border-color: #ddd;
            border-width: 1px;
            border-radius: 4px 4px 0 0;
            -webkit-box-shadow: none;
            box-shadow: none;
        }
    }
</style>
<?php
$priceAdjustTable = new BASheet('priceAdjust');
$priceAdjust = $priceAdjustTable->getListById($priceAdjustId);
$roleTable = new BASheet('priceAdjustRole', $priceAdjust);
$roleView = $roleTable->getView();

$roleList = array();
foreach ($roleView as $list) {
    $roleId = $list->getItem('roleId')->getValue();
    $roleList[$roleId] = new BRole($roleId);
}
?>
<p class="text-right"><?php
    echo $control->getAjaxLink(
            array('name' => '价格调整列表', 'id' => 'showPriceAdjustList'), array(
        'bookableId' => $bookableId
    ));
    ?>
    <?php
    if ($priceAdjustId > 0) {
        echo "|";
        echo $control->getAjaxLink(array('name' => '设置价格调整', 'id' => 'showAddPriceAdjust'), array(
            'bookableId' => $bookableId,
            'priceAdjustId' => $priceAdjustId
        ));
    }
    ?>|会员列表
    <?php
    if ($priceAdjustId > 0) {
        echo "|";
        echo $control->getAjaxLink(array('name' => '最后价格表', 'id' => 'showFinalPriceList'), array(
            'bookableId' => $bookableId,
            'priceAdjustId' => $priceAdjustId
        ));
    }
    ?>
    
    
</p>
<table class="table table-hover">
    <thead>
        <tr>
            <th>
                <input type="checkbox"  id="selectAll"> 
            </th>
            <th><?php echo '角色名称'; ?></th>
            <th><?php echo '所在应用'; ?></th>
            <th><?php echo '操作'; ?></th>
        </tr> 
    </thead>
    <fieldset>
        <tbody>
            <?php
            foreach ($roleView as $id=>$list) {
                $roleId = $list->getItem('roleId')->getValue();
                $role = new BRole($roleId);
                $appId = $role->appId;
                $app = BApp::getAppById($appId);
                $appClass = get_class($app);
                $roleFullName = $role->getFullName();
                $roleFullName = str_replace('app_root.app_customer.', '', $roleFullName);
                ?>
                <tr>
                    <td><label class="checkbox">
                            <input type="checkbox" name="checkbox[]" value="<?php echo $list->getId(); ?>"> 
                        </label></td>
                    <td><?php echo $role->getName(); ?></td>
                    <td><?php echo $appClass; ?></td>
                    <td><?php echo $control->getAjaxLink(array('name' => '删除', 'id' => 'deleteRole'),array(
                        'bookableId'=>$bookableId,
                        'priceAdjustId'=>$priceAdjustId,
                        'priceAdjustRoleId'=>$id
                    )); ?></td>
                </tr>
            <?php } ?>
        </tbody>
    </fieldset>
</table>
<div class="roleList">
    <?php
    echo $control->getAjaxLink(array('name' => '新增角色', 'id' => 'showAddRole'), array(
        'bookableId' => $bookableId,
        'priceAdjustId' => $priceAdjustId,
        'htmlOptions' => array(
            'class' => 'btn'
    )));
    ?>
</div>